'Required functions neccessary for our custom CloseApp subroutine.
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Integer, ByVal wCmd As Integer) As Integer
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Command1_Click()
Dim dummylong As Long
Dim mystring As String
Dim pos As Integer
'We need to run the winipcfg proggie.
dummylong = Shell("winipcfg.exe", 2)
AppActivate dummylong
DoEvents
'Copy the info to the Clipboard.
SendKeys "^+C", True
DoEvents
'Now close the winifcfg proggie by calling our custom subroutine.
Call CloseApp
'Load the copied info from the Clipboard to our string.